package com.turing.post.organization.util;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.turing.post.util.PCPSUtil;

/**
 * 平台机构隶属关系（SysBranchSubord）
 * 
 * @author zxp
 * @Jan 3, 2013
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "SysBranchSubord")
@IdClass(SysBranchSubord.class)
public class SysBranchSubord implements java.io.Serializable {
    /**
     * 机构号
     */
	private String branchNo;
	/**
	 * 子机构 
	 */
	private String subBranchNo;
	/**
	 * 子机构类型
	 */
	private String subBranchType;
	/**
	 * 子机构的父机构
	 */
	private String subBranchSuperNo;

	public SysBranchSubord() {

	}

	@Id
	@Column(name = "BRANCHNO")
	public String getBranchNo() {
		return branchNo;
	}

	public void setBranchNo(String branchNo) {
		this.branchNo = branchNo;
	}

	@Id
	@Column(name = "SUBBRANCHNO")
	public String getSubBranchNo() {
		return subBranchNo;
	}

	public void setSubBranchNo(String subBranchNo) {
		this.subBranchNo = subBranchNo;
	}

	@Column(name = "SUBBRANCHTYPE")
	public String getSubBranchType() {
		return subBranchType;
	}

	public void setSubBranchType(String subBranchType) {
		this.subBranchType = subBranchType;
	}

	@Column(name = "SUBBRANCHSUPERNO")
	public String getSubBranchSuperNo() {
		return subBranchSuperNo;
	}

	public void setSubBranchSuperNo(String subBranchSuperNo) {
		this.subBranchSuperNo = subBranchSuperNo;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((this.getBranchNo() == null) ? 0 : this.getBranchNo()
						.hashCode());
		result = prime
				* result
				+ ((this.getSubBranchNo() == null) ? 0 : this.getSubBranchNo()
						.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof SysBranchSubord))
			return false;
		SysBranchSubord other = (SysBranchSubord) obj;
		if (!PCPSUtil.compareObject(this.getBranchNo(), other.getBranchNo()))
			return false;
		return PCPSUtil.compareObject(this.getSubBranchNo(), other
				.getSubBranchNo());
	}
}